package com.sjb.cp.model.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * @Author:sjb
 * @CreateTime:2025-02-20
 * @Description: 图片编辑消息类型枚举
 * @Version：1.0
 */
@Getter
public enum PictureEditMessageTypeEnum {

    INFO("发送通知", "INFO"),
    ERROR("发送错误", "ERROR"),
    ENTER_EDIT("进入编辑状态", "ENTER_EDIT"),
    EXIT_EDIT("退出编辑状态", "EXIT_EDIT"),
    EDIT_ACTION("执行编辑操作", "EDIT_ACTION");

    private final String text;

    private final String value;

    PictureEditMessageTypeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取enum
     * @param value
     * @return
     */
    public static PictureEditMessageTypeEnum getEnumByValue(String value) {
        if (StrUtil.isEmpty(value)){
            return null;
        }

        for (PictureEditMessageTypeEnum pictureEditMessageTypeEnum : PictureEditMessageTypeEnum.values()) {
            if (pictureEditMessageTypeEnum.getValue().equals(value)) {
                return pictureEditMessageTypeEnum;
            }
        }
        return null;
    }
}
